package com.google.code.securityflow.ast

object SourceLocation {
  def synthetic = SourceLocation("<synthetic>", 0, 0);
}

case class SourceLocation(fileName: String, lineNumber: Int, position: Int) extends Ordered[SourceLocation] {

  val order = Ordering.by[SourceLocation, (String, Int, Int)](location => (location.fileName, location.lineNumber, location.position));

  def compare(that: SourceLocation): Int = {
    order.compare(this, that);
  }

  def toPrettyString = fileName + ":" + lineNumber;
}